import java.util.*;
class Main
{
	
	int tot;
	int ans[] = new int[4];
	
	void output(int i){
		System.out.printf("%d %d QUARTER(S), %d DIME(S), %d NICKEL(S), %d PENNY(S)\n",
					i, ans[0], ans[1], ans[2], ans[3]);
	}
	
	void go()
	{

        Scanner cin = new Scanner(System.in);
        int n;
        n = cin.nextInt();
        for (int i=1; i<=n; ++i)
        {
        	tot = cin.nextInt();
        	Arrays.fill(ans, 0);
        	ans[0] = tot/25;
        	tot %= 25;
        	ans[1] = tot/10;
        	tot %= 10;
        	ans[2] = tot/5;
        	tot %= 5;
        	ans[3] = tot;  
        	output(i);      	
        }

        
	}

    public static void main(String args[])

    {
		
		new Main().go();

    }

}
